// wire.h
#ifndef WIRE_H
#define WIRE_H

#include <QGraphicsPathItem>
#include <QPen>
#include "component.h"

class Wire : public QGraphicsPathItem
{
public:
    Wire(QGraphicsItem *parent = nullptr);

    void setStartComponent(Component *component);
    void setEndComponent(Component *component);
    void setStartPos(const QPointF &pos);
    void setEndPos(const QPointF &pos);
    void addPoint(const QPointF &point);

    Component *startComponent() const;
    Component *endComponent() const;
    QPointF startPos() const;
    QPointF endPos() const;

private:
    void updatePath();

    Component *m_startComponent;
    Component *m_endComponent;
    QPointF m_startPos;
    QPointF m_endPos;
    QList<QPointF> m_points;
    QPen m_pen;
};

#endif // WIRE_H
